package com.example.administrator.food.utils;

import android.app.Application;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

import java.util.HashMap;
import java.util.Map;


/**
 * User: lx(751981350@qq.com)
 * Date: 2016/09/21
 * Time: 09:52
 * progject: OurQianFan
 * Describe：
 */
public class BaseApp extends Application {

    private boolean isLogin;//记录当前登录状态
    private static BaseApp baseApp;
    private RequestQueue mRequestQueue;
    private Map<String, Object> oneClickLoginData;

    @Override
    public void onCreate() {
        super.onCreate();
        baseApp= this;
        initVolley();
        initUserData();

    }
    private void initUserData() {
        oneClickLoginData= new HashMap<>();
    }


    private void initVolley() {

        mRequestQueue = Volley.newRequestQueue(getApplicationContext());
    }

    public static BaseApp getMyApp() {
        return baseApp;
    }

    public RequestQueue getRequestQueue() {
        return mRequestQueue;
    }
    /*设置登录状态*/
    public void setLoginState(boolean isLogin){
        this.isLogin=isLogin;
    }
    /**
     * 获取登录状态
     * true 登陆
     * false 没有登陆
     */
    public boolean isLogin() {
        return isLogin;
    }
    public Map<String, Object> getOneClickLoginData() {
        return oneClickLoginData;
    }

    public void setOneClickLoginData(Map<String, Object> oneClickLoginData) {
        this.oneClickLoginData = oneClickLoginData;
    }
}
